import request from '@/axios'

export const getMenuListApi = (params) => {
  return request.get({ url: '/system/menu/list', params })
}

export const getMenuListForRoleApi = () => {
  return request.get({ url: '/system/menu/treeselect' })
}

export const getMenuListByRoleIdApi = (roleId) => {
  return request.get({ url: '/system/menu/by-role/' + roleId })
}

export const saveTableApi = (data: any): Promise<IResponse> => {
  return request.post({ url: '/system/menu/create', data })
}

export const updateTableApi = (data: any): Promise<IResponse> => {
  return request.post({ url: '/system/menu/edit', data })
}

export const deleteMenuApi = (data: any) => {
  return request.post({ url: '/system/menu/delete', params: data })
}
